package com.sgb.kjwl.view.ui.adapter.enterprise;

import android.content.Context;

import androidx.annotation.DrawableRes;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ItemIpPickSelectBinding;
import com.sgb.kjwl.model.entity.PickSelectEntity2;
import com.sgb.kjwl.model.entity.enterprise.IpPickSelectEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class CirclePickSelectAdapter<D extends PickSelectEntity2> extends BaseRecycleAdapter<D> {

    ItemIpPickSelectBinding binding;

    public CirclePickSelectAdapter(Context context, List<D> datas) {
        super(context, R.layout.item_ip_pick_select, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, D ipPickSelectEntity) {
        holder.setBinding(BR.viewModel, ipPickSelectEntity);
        binding = (ItemIpPickSelectBinding) holder.getmBinding();

        binding.nameView.setText(ipPickSelectEntity.getName());

        if (ipPickSelectEntity.getColor() != 0){
            binding.rootLayout.setBackgroundResource(ipPickSelectEntity.getColor());
        }
    }

}
